import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)
import Layout from '@/layout' //页面整体布局
/**
 * constantRoutes
 *没有权限要求的页面
 *可以访问所有角色
 */
export const constantRoutes = [
	{
		path: '/redirect',
		component: Layout,
		meta: {
			title: '重定向',
		},
		hidden: true, //不需要显示在侧边导航
		children: [{
			path: '/redirect/:path(.*)',
			component: () => import('@/views/redirect/index')
		}],
	},
	{
		path: '/Login',
		name: "Login",
		meta: {
			title: "登录"
		},
		hidden: true,
		component: () => import('@/views/Login/Login')
	},
	{
		path: '/Register',
		name: "Register",
		meta: {
			title: "注册"
		},
		hidden: true,
		component: () => import('@/views/Register/Register')
	},
	{
		path: '/',
		component: Layout,
		redirect: '/Home',
		children: [{
			path: '/Home',
			name: 'Home',
			meta: {
				title: '首页',
				icon: 'el-icon-s-home'
			},
			isTopDirectory: true, //是否作为上级目录
			component: () => import('@/views/Home/Home')
		}]
	}
]
/**
 *异步路由
 *需要根据用户角色动态加载的路由
 */
export const asyncRoutes = [
	// {
	// 	path: '/MasterDataManagement',
	// 	name: 'MasterDataManagement',
	// 	redirect: '/CustomerInfo',
	// 	meta: {
	// 		title: '主数据管理',
	// 		icon: 'el-icon-s-platform'
	// 	},
	// 	component: Layout,
	// 	children: []
	// }

]
// const routes = constantRoutes.concat(asyncRoutes)
const routes = constantRoutes
const router = new VueRouter({
	// mode: 'history',
	// base: process.env.BASE_URL,
	routes
})

export default router
